<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>#MenuMaskKey</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>#MenuMaskKey <span class="ver">[AHK_L 38+]</span></h1>

<p>Changes which key is used to mask Win or Alt keyup events.</p>

<pre class="Syntax">#MenuMaskKey KeyName</pre>
<h3>Parameters</h3>
<dl>

  <dt>KeyName</dt>
  <dd><p>A <a href="../KeyList.htm">key name</a> or vkNN sequence which specifies a non-zero virtual keycode.  Scan codes are not used.</p></dd>

</dl>

<h3>Remarks</h3>
<p>This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.</p>
<p>If a hotkey is implemented using the keyboard hook or mouse hook, the final keypress may be invisible to the active window and the system.  For hotkeys which use a Win or Alt modifier key, this could result in the Start menu or active window's menu bar being activated when the modifier key is released.  To prevent this from happening, AutoHotkey "masks" the keyup event by sending a keystroke.  Prior to Revision 38, this was always a Ctrl keystroke, and was known to cause problems with certain applications.</p>
<p>If this directive is unspecified in the script, it will behave as though set to Ctrl.</p>

<h3>Related</h3>
<p>See <a href="http://www.autohotkey.com/forum/topic22378.html">this thread</a> for background information.</p>

<h3>Examples</h3>
<pre class="NoIndent">#MenuMaskKey vk07  <em>; vk07 is unassigned.</em>
#UseHook
#Space::
!Space::
    KeyWait LWin
    KeyWait RWin
    KeyWait Alt
    KeyHistory
return</pre>

</body>
</html>
